//2009/08/01 18:13:47
#include <vector>
#include <string>
using namespace std;

class BombSweeper
{
public:
	double winPercentage(vector <string> board)
	{
		int wins =0;
		int loss = 0;
		for(int i=0; i<board.size(); i++)
		{
			for(int j=0; j<board[0].size(); j++)
			{
				if(board[i][j] == 'B')
				{
					loss++;
					continue;
				}
				if(check(i,j,board))
					wins++;
			}
		}
		return (double)(wins*1.0 /(wins+loss))*100.0; // Take care of the difference between wins and wins*1.0;
	}
private:
	bool check(int m, int n, vector<string> b)
	{
		if(m>0)
		{
			if(n>0 && b[m-1][n-1] != '.')
				return false;
			else if(b[m-1][n] != '.')
				return false;
			else if(n+1 <b[0].size() && b[m-1][n+1]!='.')
				return false;
		}
		if(n>0 && b[m][n-1]!='.')
			return false;
		if(n+1 < b[0].size() && b[m][n+1]!='.')
			return false;
		if(m+1 < b.size())
		{
			if(n>0 && b[m+1][n-1]!='.')
				return false;
			if(b[m+1][n]!='.')
				return false;
			if(n+1<b[0].size() && b[m+1][n+1]!='.')
				return false;
		}
		return true;
	}
};
